package cn.yiueil.controller;

import cn.yiueil.entity.User;
import cn.yiueil.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class BaseController {
    @Autowired
    UserService userService;

    @RequestMapping(value = "hello")
    public String hello(Model model) {
        User user = new User();
        user.setName("xiaowb");
        userService.register(user);
        model.addAttribute("user", user);
        return "result";
    }

    @RequestMapping(value = "hello2")
    public String hello2() {
        userService.login("1", "1");
        return "result";
    }
}
